package com.example.langchain4j.controller;

import com.example.langchain4j.aiService.ConsultantService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class LangChain4j {
    @Resource
    private ConsultantService consultantService;

    @RequestMapping(value = "/chat" ,produces = "text/html;charset=utf-8")
    public Flux<String> chat( String memoryId , String message){
        Flux<String> result = consultantService.chat(memoryId , message);
        return result;
    }


//    @RequestMapping("/chat")
//    public String chat(String message){
//        String result = consultantService.chat(message);
//        return result;
//    }
//    @Resource
//    private OpenAiChatModel model;
//    @GetMapping("/chat")
//public String chat(String message){
//    return model.chat(message);
//    }
}
